package com.reger.l2cache.pipeline.ops;

import java.util.List;
import java.util.Map;

import org.springframework.data.redis.connection.RedisStringCommands.BitOperation;
import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.lang.Nullable;

public interface RedisStringPipeline<K, V> extends RedisKeyPipeline<K> {

	@Nullable
	V get(K key);

	@Nullable
	V getSet(K key, V value);

	@Nullable
	List<V> mGet(@SuppressWarnings("unchecked") K... keys);

	@Nullable
	Boolean set(K key, V value);

	@Nullable
	Boolean set(K key, V value, Expiration expiration, SetOption option);

	@Nullable
	Boolean setNX(K key, V value);

	@Nullable
	Boolean setEx(K key, long seconds, V value);

	@Nullable
	Boolean setNxEx(K key, long seconds, V value);

	@Nullable
	Boolean pSetEx(K key, long milliseconds, V value);

	@Nullable
	Boolean pSetNxEx(K key, long milliseconds, V value);

	@Nullable
	Boolean mSet(Map<K, V> tuple);

	@Nullable
	Boolean mSetNX(Map<K, V> tuple);

	@Nullable
	Long incr(K key);

	@Nullable
	Long incrBy(K key, long value);

	@Nullable
	Double incrBy(K key, double value);

	@Nullable
	Long decr(K key);

	@Nullable
	Long decrBy(K key, long value);

	@Nullable
	Long append(K key, byte[] value);

	@Nullable
	byte[] getRange(K key, long start, long end);

	void setRange(K key, byte[] value, long offset);

	@Nullable
	Boolean getBit(K key, long offset);

	@Nullable
	Boolean setBit(K key, long offset, boolean value);

	@Nullable
	Long bitCount(K key);

	@Nullable
	Long bitCount(K key, long start, long end);

	@Nullable
	Long bitOp(BitOperation op, K destKey, @SuppressWarnings("unchecked") K... keys);

	@Nullable
	Long strLen(K key);

	default RedisStringPipeline<K, V> toStrPl() {
		return this;
	}
}
